﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using Sern.Abstracts.Tracker.DataContracts;
using Sern.Common;

namespace Sern.Abstracts.Tracker.ServiceContracts
{
    [ServiceContract]
    public interface ITrackerHost
    {
        /// <summary>
        /// Starts a new "unbounded" job.
        /// </summary>
        /// <param name="jobId"> </param>
        /// <param name="keywords"></param>
        /// <param name="description"></param>
        /// <returns>The tracker Uri for the new job.</returns>
        [OperationContract]
        void StartANewJob(Guid jobId, IEnumerable<string> keywords, string description);

        /// <summary>
        /// Remove the given job.
        /// </summary>
        /// <param name="jobId"> </param>
        [OperationContract]
        void EndAGivenJob(Guid jobId);

        /// <summary>
        /// Search for a given tracker using the predicate expression.
        /// </summary>
        /// <param name="predicate"></param>
        /// <param name="skip"></param>
        /// <param name="take"></param>
        /// <returns></returns>
        [OperationContract]
        [ExpressionSerializingOperationBehavior]
        IEnumerable<TrackerInfo> List(Expression<Func<TrackerInfo, bool>> predicate, int skip = 0, int take = 25);

        /// <summary>
        /// Update the keyword and description for the given job.
        /// </summary>
        /// <param name="jobId"> </param>
        /// <param name="keywords"></param>
        /// <param name="description"></param>
        [OperationContract]
        void UpdateTrackerInformation(Guid jobId, IEnumerable<string> keywords, string description);
    }
}
